package com.ztorn.fiscale.service.impl;

import java.util.List;

import com.ztorn.common.core.utils.DateUtils;
import com.ztorn.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ztorn.fiscale.mapper.FiscaleDocumentTypeMapper;
import com.ztorn.fiscale.domain.FiscaleDocumentType;
import com.ztorn.fiscale.service.IFiscaleDocumentTypeService;

/**
 * 单证类型Service业务层处理
 *
 * @author ztorn
 */
@Service
public class FiscaleDocumentTypeServiceImpl implements IFiscaleDocumentTypeService
{
    @Autowired
    private FiscaleDocumentTypeMapper fiscaleDocumentTypeMapper;

    /**
     * 查询单证类型
     *
     * @param typeId 单证类型ID
     * @return 单证类型
     */
    @Override
    public FiscaleDocumentType selectFiscaleDocumentTypeById(Long typeId)
    {
        return fiscaleDocumentTypeMapper.selectFiscaleDocumentTypeById(typeId);
    }

    /**
     * 查询单证类型列表
     *
     * @param fiscaleDocumentType 单证类型
     * @return 单证类型
     */
    @Override
    public List<FiscaleDocumentType> selectFiscaleDocumentTypeList(FiscaleDocumentType fiscaleDocumentType)
    {
        return fiscaleDocumentTypeMapper.selectFiscaleDocumentTypeList(fiscaleDocumentType);
    }

    /**
     * 新增单证类型
     *
     * @param fiscaleDocumentType 单证类型
     * @return 结果
     */
    @Override
    public int insertFiscaleDocumentType(FiscaleDocumentType fiscaleDocumentType)
    {
        fiscaleDocumentType.setCreateTime(DateUtils.getNowDate());
        fiscaleDocumentType.setCreateBy(SecurityUtils.getUsername());
        return fiscaleDocumentTypeMapper.insertFiscaleDocumentType(fiscaleDocumentType);
    }

    /**
     * 修改单证类型
     *
     * @param fiscaleDocumentType 单证类型
     * @return 结果
     */
    @Override
    public int updateFiscaleDocumentType(FiscaleDocumentType fiscaleDocumentType)
    {
        fiscaleDocumentType.setUpdateTime(DateUtils.getNowDate());
        fiscaleDocumentType.setUpdateBy(SecurityUtils.getUsername());
        return fiscaleDocumentTypeMapper.updateFiscaleDocumentType(fiscaleDocumentType);
    }

    /**
     * 批量删除单证类型
     *
     * @param typeIds 需要删除的单证类型ID
     * @return 结果
     */
    @Override
    public int deleteFiscaleDocumentTypeByIds(Long[] typeIds)
    {
        return fiscaleDocumentTypeMapper.deleteFiscaleDocumentTypeByIds(typeIds);
    }

    /**
     * 删除单证类型信息
     *
     * @param typeId 单证类型ID
     * @return 结果
     */
    @Override
    public int deleteFiscaleDocumentTypeById(Long typeId)
    {
        return fiscaleDocumentTypeMapper.deleteFiscaleDocumentTypeById(typeId);
    }
}
